<template>
	<div class="dvservice-home">
		<div>
			<label>{{$t('route.Data_Management')}}</label>
			<div></div>
			<button><img /><label>{{$t('route.Equipment_information')}}</label></button>
		</div>

		<div>
			<div :style="{'background-color':item.title==category?'#A866FF':'#FFFFFF'}" @click="kindClick(item)"
				v-for="item in kindList">
				<img :src="item.icon" />
				<div>{{item.title}}{{$t('route.series')}}</div>
			</div>
		</div>

		<div>
			<div @click="typeNumClick(item)" v-for="item in typeNumList">
				<img :src="item.imgUrl" />
				<div>{{item.name}}</div>
				<div>{{item.number}}</div>
			</div>
		</div>


	</div>
</template>

<script>
	import http from "../../js/http/http.js";
	import api from "../../js/http/api.js";
	import CommonUtils from "../../js/common/common-utils.js";
	import Constant from '../../js/common/constant.js'
	import i18n from '../../i18n/index';
	export default {
		data() {
			return {
				kindList: Constant.DEVICE_SERVICE_KIND_LIST,
				typeNumList: [],
				category: i18n.global.t('route.automata')
			};
		},
		methods: {
			getDeviceTypeList() {
				http.post(api.GET_DEVICE_TYPE_LIST, {
					category: this.category
				}, data => {
					this.typeNumList = data.data;
				})
			},
			kindClick(item) {
				this.category = item.title;
				this.getDeviceTypeList();
			},
			typeNumClick(item) {
				var pageName = this.$store.state.user.type == 0 ? 'admin-device-service' : 'customer-device-service';
				this.$router.push({
					name: pageName,
					params: {
						typeNum: item.number
					}
				});
			}
		},
		created() {
			this.getDeviceTypeList();
		}
	};
</script>
<style lang="scss" scoped>
	.dvservice-home {
		color: #444444;
		font-size: 18px;
		padding-right: 20px;
		height: calc(100vh - 100px);
		// overflow: scroll;
		scrollbar-width: none;
		/* firefox */
		-ms-overflow-style: none;
		/* IE 10+ */
		overflow-x: hidden;
		overflow-y: auto;

		>div {
			display: flex;
			flex-direction: row;
			margin-top: 20px;
			background-color: #ffffff;
			padding: 20px;
			border-radius: 5px;
		}

		>div:nth-of-type(1) {
			>label:nth-of-type(1) {
				font-weight: 600;
			}

			>div:nth-of-type(1) {
				width: 1px;
				background-color: #cccccc;
				height: 15px;
				margin: 0px 20px;
			}

			>button:nth-of-type(1) {
				background-image: url(../../assets/img/customer-1.png);
				background-repeat: no-repeat;
				background-size: 100% 100%;
				padding: 5px 10px;
				border: 0px;
				display: flex;
				color: #ffffff;
				flex-direction: row;
				align-items: center;
				font-weight: 800;

				>img {
					margin-right: 7px;
					width: 15px;
					height: 15px;
					content: url(../../assets/img/customer-2.png);
				}

			}
		}

		>div:nth-of-type(2) {
			display: block;

			>div {
				display: inline-block;
				margin-left: 60px;
				text-align: center;
				font-size: 20px;
				border-radius: 10px;
				padding-bottom: 10px;

				>img {
					margin-bottom: 10px;
					width: 136px;
					height: 90px;
				}
			}
		}

		>div:nth-of-type(3) {
			display: block;
			font-weight: 800;

			>div {
				margin-top: 50px;
				margin-left: 20px;
				display: inline-block;
				font-size: 20px;
				border: 1px solid #EEEEEE;
				padding: 15px;

				>img {
					width: 250px;
					height: 201px;
					border-radius: 10px;
				}

				>div {
					margin-left: 10px;
					margin-top: 10px;
				}
			}
		}




	}
</style>
